(ns clojure-demo.packet)
 (:use '[clojure.java.io]) 

(def payloads (ref {} ))
(def headers (ref {} ))

;(def song (ref #{}))
;( (dosync (alter song conj "heal the world")))

;field
{"name", "type", "len", "offset", "error"}
;packet
{"name", "bytes", "len","offset", "error","header_len","headers","lastname", "payload" }

(defn registerPacket [name myheaders]
  ( (dosync (alter headers conj [name myheaders]))))

(defn registerPayload [name &fns]
  ( (dosync (alter payloads conj [name fns]))))
